//订单


var express = require('express');
var router = express.Router();
var ordersApi = require('../api/orders')
/* GET home page. */
router.get('/', async function (req, res, next) {//获取所有的订单详情
    let { limit, page } = req.query;
    let data = await ordersApi.get({ limit, page })
    res.send({ "code": 0, "msg": "", "count": data.total, "data": data.rows });
});
router.post('/', async function (req, res, nex) {
    const order = req.body;
    order.seats = JSON.parse(order.seats);
    const data = await ordersApi.add(order);
    res.send(data)
})


module.exports = router;